package com.niiwoo.civet.user.service.duboo.asset;

import com.alibaba.dubbo.config.annotation.Service;
import com.niiwoo.civet.user.dao.entity.FltFundChannel;
import com.niiwoo.civet.user.dto.response.fanlitou.FanLiTouRespDTO;
import com.niiwoo.civet.user.service.asset.FundUserDubboService;
import com.niiwoo.civet.user.service.local.asset.FundUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * @Description:
 * @Author:liujinping
 * @Date:2018/7/17
 */
@Slf4j
@Service(version = "1.0.0")
public class FundUserDubboServiceImpl implements FundUserDubboService {

    @Autowired
    private FundUserService fundUserService;

    @Override
    public List<FanLiTouRespDTO> getUserListByFlt(){
        List<FanLiTouRespDTO> fanLiTouRespDTOList = new ArrayList<>();
        List<FltFundChannel> list = fundUserService.getAllUserByFlt();
        if(!CollectionUtils.isEmpty(list)){
            for(FltFundChannel fltFundChannel : list){
                FanLiTouRespDTO fanLiTouRespDTO = new FanLiTouRespDTO();
                fanLiTouRespDTO.setUid(fltFundChannel.getUid());
                fanLiTouRespDTO.setUserId(fltFundChannel.getUserId());
                fanLiTouRespDTO.setMobileNo(fltFundChannel.getMobileNo());
                fanLiTouRespDTOList.add(fanLiTouRespDTO);
            }
        }
        return fanLiTouRespDTOList;
    }
}
